//
//  IManager+ModuleMerchantFavourite.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-9-28.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleMerchantFavourite.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "GloableEngineService.h"
#import "RCFeedbackDataModel.h"

@implementation IManager(ModuleMerchantFavourite)

-(int64_t)requestMerchantAddFavourite:(NSString *)merchantID withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:merchantID]) {
        return kInvalidRequestId;
    }
    NSString *bduss = [GloableEngineService sharedInstance].bduss;
    NSString *urlSuffix = [NSString stringWithFormat:kRCMerchantAddFavouritePrefix,merchantID,bduss];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCFeedbackDataModel class]
                                                     withDataDelegate:delegate];
    
}

-(int64_t)requestMerchantDeleteFavourite:(NSString *)merchantID withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:merchantID]) {
        return kInvalidRequestId;
    }
    NSString *bduss = [GloableEngineService sharedInstance].bduss;
    NSString *urlSuffix = [NSString stringWithFormat:kRCMerchantDeleteFavouritePrefix,merchantID,bduss];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCFeedbackDataModel class]
                                                     withDataDelegate:delegate];
}

@end
